<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
        '<div contenteditable>',
            '<div>one \u00A0</div>',
            '<div>^two \u00A0|</div>',
            'three \u00A0',
            '<div>four \u00A0</div>',
            '<div id="target"><br></div>',
        '</div>',
    ],
    selection => {
        if (!window.testRunner)
            throw 'This test requires testRunner.';
        selection.document.execCommand('Copy');
        selection.collapse(selection.document.getElementById('target'), 0);
        selection.document.execCommand('Paste');
    },
    [
        '<div contenteditable>',
            '<div>one \u00A0</div>',
            '<div>two \u00A0</div>',
            'three \u00A0',
            '<div>four \u00A0</div>',
            '<div id="target">two\u00A0\u00A0|</div>',
        '</div>',
    ]);
</script>
